class Solution {
    public ListNode reverseList(ListNode head) {
     if(head == null) return null;
       ListNode cur = head ;
        while(cur.next != null){
        ListNode curNext = cur.next ;      
        cur.next = curNext.next ;
        curNext.next = head ;
         head = curNext ;
       }
     return head ;
    }
}